import { createRouter, createWebHashHistory } from "vue-router";
import { constantRoutes } from "./modules";
import NProgress from "@/utils/progress";

const router = createRouter({
  history: createWebHashHistory(),
  routes: constantRoutes,
  scrollBehavior: () => ({ left: 0, top: 0 })
});

// 移除权限守卫逻辑，所有路由直接放行
router.beforeEach((_to, _from, next) => {
  NProgress.start();
  next();
});

router.afterEach(() => {
  NProgress.done();
});

export default router;
